<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Map管理DOM节点</title>
</head>

<body>
    <div name='后盾人'>houdunren.com</div>
    <div name='开源内容管理系统'>hdcms.com</div>
</body>
<script>
    let map = new Map();
    document.querySelectorAll('div').forEach(item => {
        map.set(item, {
            content: item.getAttribute('name'),
        });
    });
    map.forEach((config, elem) => {
        elem.addEventListener('click', () => {
            alert(config.content);
        });
    });
</script>

</html>